<?php 
include_once 'config.php';

$user = $_POST['user'];
$password = $_POST['pass'];
$hash = md5($password);

function proceed($user, $rank) {
	// Start our PHP Session
	session_start();
	$_SESSION['account_name'] = $user;
	$_SESSION['account_rank'] = $rank;
	$_SESSION['logged_in']  = 1;
	header('Location: page.php?p=main');
}


// load our ini
	$content = parse_ini_file("./users.ini.php", true);
	// write them out using their rekeys as their keys ;-)
	if (array_key_exists($user, $content) && $content[$user]['md5'] == $hash) {
		proceed($user, $content[$user]['type']);
	}


else {
	header('Location: page.php');
}

?>
